package com.glc.gao.gavin.rxjavademo.operator;

import android.view.View;

import com.glc.gao.gavin.rxjavademo.R;

import io.reactivex.Observable;
import io.reactivex.annotations.NonNull;
import io.reactivex.functions.Consumer;

public class LastActivity extends BaseActivity {
    @Override
    public int getDescribeText() {
        return R.string.describe_last;
    }

    @Override
    protected int getContextView() {
        return R.layout.activity_last;
    }

    public void executeLast(View view) {
        Observable.just(1, 2, 3)
                .last(4)
                .subscribe(new Consumer<Integer>() {
                    @Override
                    public void accept(@NonNull Integer integer) throws Exception {
                       print("last : " + integer + "\n");
                    }
                });
    }
}
